# coding=utf-8
# !/usr/bin/python3


import requests

cookies = {
    'https_waf_cookie': '44d0cfbc-11e0-46eb2c3cb4cc49c64d0f1f18ba8f203b7d2c',
    'yb_header_active': '-1',
    'yb_header_show': 'true',
}

headers = {
    'Accept': 'application/json',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Cache-Control': 'no-cache',
    'Connection': 'keep-alive',
    'Content-Type': 'application/json',
    # 'Cookie': 'https_waf_cookie=44d0cfbc-11e0-46eb2c3cb4cc49c64d0f1f18ba8f203b7d2c; yb_header_active=-1; yb_header_show=true',
    'Origin': 'https://fuwu.nhsa.gov.cn',
    'Pragma': 'no-cache',
    'Referer': 'https://fuwu.nhsa.gov.cn/nationalHallSt/',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
    'X-Tingyun': 'c=B|4Nl_NnGbjwY;x=d244fbe9afa749fa',
    'channel': 'web',
    'contentType': 'application/x-www-form-urlencoded',
    'sec-ch-ua': '"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'x-tif-nonce': 'A6uN6B7S',
    'x-tif-paasid': 'undefined',
    'x-tif-signature': '214caa5b4f763175615be0a1cbee2cbb84fa2624f9cb696f18171d67bc60e518',
    'x-tif-timestamp': '1725195337',
}

json_data = {
    'data': {
        'data': {
            'encData': '3DFBCA4667B978F639BB23B95DCE4CC74CE34C33DC32F1068E9E23CA546C9EA8CCD20943B4DAE96380B41164D761DE9742C84A985FE3BABC31CB352556BB87C9C1495DB24A29AB6BC3A85AB7FCA00F33C56677481A67C67F739EE2C7D589054DC373615B5DDB33C24C5B31E61CB7643E8CCAA19EAE1FD36157CF9869E3A3753ED0B4E7BB97C60BF8E5275CAFCAFD1E13E384C10195003FD638576645B5EF45EA',
        },
        'appCode': 'T98HPCGN5ZVVQBS8LZQNOAEXVI9GYHKQ',
        'version': '1.0.0',
        'encType': 'SM4',
        'signType': 'SM2',
        'timestamp': 1725195337,
        'signData': '9V2qRVp7UDdU5USFSVirgpjd3hgz1QwD3zYLmYTfu1EFc7RAGCEY+8mQmxTve3pVDLQmTdCXxiImb1mH565mVQ==',
    },
}

response = requests.post(
    'https://fuwu.nhsa.gov.cn/ebus/fuwu/api/nthl/api/CommQuery/queryFixedHospital',
    cookies=cookies,
    headers=headers,
    json=json_data,
).json()
print(response)

# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{"data":{"data":{"encData":"3DFBCA4667B978F639BB23B95DCE4CC74CE34C33DC32F1068E9E23CA546C9EA8CCD20943B4DAE96380B41164D761DE9742C84A985FE3BABC31CB352556BB87C9C1495DB24A29AB6BC3A85AB7FCA00F33C56677481A67C67F739EE2C7D589054DC373615B5DDB33C24C5B31E61CB7643E8CCAA19EAE1FD36157CF9869E3A3753ED0B4E7BB97C60BF8E5275CAFCAFD1E13E384C10195003FD638576645B5EF45EA"},"appCode":"T98HPCGN5ZVVQBS8LZQNOAEXVI9GYHKQ","version":"1.0.0","encType":"SM4","signType":"SM2","timestamp":1725195337,"signData":"9V2qRVp7UDdU5USFSVirgpjd3hgz1QwD3zYLmYTfu1EFc7RAGCEY+8mQmxTve3pVDLQmTdCXxiImb1mH565mVQ=="}}'
#response = requests.post(
#    'https://fuwu.nhsa.gov.cn/ebus/fuwu/api/nthl/api/CommQuery/queryFixedHospital',
#    cookies=cookies,
#    headers=headers,
#    data=data,
#)

